<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/views/common/taglibs.jsp" %>

<!DOCTYPE>
<html>
<head>
    <!-- 引入通用js、css文件(xiaogq) -->
    <meta name="decorator" content="default"/>
    <link rel="stylesheet" type="text/css" href="${ctx}/css/common/operation/sys_operation.css"/>
</head>
<body>
<div class="button_list">
    <a href="javascript:;" tableCode="${entityId}" onclick="saveSelecBoxEnum();">
        <span class="span_button">
            <span><img src="${ctx}/image/common/operation/oper_SAVE.png"></span>
            <span name="buTitle">保存</span>
        </span>
    </a>
    <a href="javascript:;" onclick="javascript:parent.closeTab();">
        <span class="span_button">
            <span><img src="${ctx}/image/common/operation/oper_CANCEL.png"></span>
            <span name="buTitle">取消</span>
        </span>
    </a>
</div>
<div id="content_modal">
    <form role="form" id="selectbox_form" method="post">
        <input type="hidden" value="${sb.id}" name="id" />
        <input type="hidden" value="${sb.entityId}" name="entityId" />
        <input type="hidden" value="${sb.field.id}" name="field.id" />
        <div style="margin: 10px 0" class="">
            <label style="width: 100px;text-align: right;" class="">属性名称:<span style="color: red">*</span></label>
            <input style="width: 220px;display: inline;" type="text" class="form-control" id="name" name="name" value="${sb.name}">
        </div>
        <div style="margin: 10px 0" class="">
            <label style="width: 100px;text-align: right;" class="">描述: </label>
            <input style="width: 220px;display: inline;"  type="text" class="form-control" id="valsComment" name="valsComment" value="${sb.valsComment}">
        </div>
        <div style="margin: 10px 0" class="contentMid">
            <label style="width: 100px;text-align: right;">默认值:</label>
            <input   type="checkbox" id="defaultValue" <c:if test="${sb.defaultValue}">checked</c:if> name="defaultValue"/>
        </div>
    </form>
</div>
<script type="text/javascript">
    //form表单提交方法(xiaogq)
    function saveSelecBoxEnum(){
        var name = $("#name").val();
        if(trim(name) == ""){
            alert('请填写属性名!');
            return;
        }
        $.ajax({
            type: "POST",
            url:"${ctx}/"+Constants.selectBoxEditSaveUrl,
            data:$("#selectbox_form").serialize(),// 要提交的表单
            async:true,
            success:function(data) {
                var flag = data.flag;
                if(flag){
                    alert("编辑枚举字段成功!");
                }else{
                    alert("编辑枚举字段失败!");
                }
                parent.closeTab(1);
            },
            error: function(){
                alert("编辑枚举字段异常!");
            }
        });
    }
</script>
</body>
</html>
